#define _CRT_SECURE_NO_WARNINGS 1
#include <string>
#include <iostream>
using namespace std;


void Reverse(string& str, size_t b, size_t e)
{
    char tmp;
    while (b < e)
    {
        tmp = str[b];
        str[b] = str[e];
        str[e] = tmp;
        b++;
        e--;
    }
}

string test01()
{
    string s("Let's take LeetCode contest");
    int begin = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == ' ')
        {
            Reverse(s, begin, i - 1);
            begin = i + 1;
        }
    }
    return s;
}

string test02()
{
    string s("Let's take LeetCode contest");
    size_t end = 0;
    size_t start = 0;
    while (1)
    {
        end = s.find(' ', start);
        if (end == string::npos)
        {
            end = s.size();
            break;
        }
        Reverse(s, start, end - 1);
        start = end + 1;
    }
    Reverse(s, start, end - 1);
    return s;
}


void test03()
{
    string s;
    getline(cin, s);

    size_t size = s.size();
    size_t start = 0;
    size_t end = s.find(' ', start);

    while (end != string::npos)
    {
        end = s.find(' ', start);
        start = end + 1;
    }
    cout << size - start << endl;
}

int main()
{
    //test01();
    //test02();
    test03();
    return 0;
}